<?php
// +----------------------------------------------------------------------
// | 萤火商城系统 [ 致力于通过产品和服务，帮助商家高效化开拓市场 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2023 https://www.yiovo.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed 这不是一个自由软件，不允许对程序代码以任何形式任何目的的再发行
// +----------------------------------------------------------------------
// | Author: 萤火科技 <admin@yiovo.com>
// +----------------------------------------------------------------------
declare (strict_types=1);

namespace app\api\controller;

use app\api\model\Help as HelpModel;
use app\api\model\wxapp\Setting as WxappSettingModel;
use app\common\library\helper;
use app\common\service\bangdou\BdPay as BdPayService;
use app\common\service\bangdou\Common as CommonService;
use app\models\bangdou\BdPay;
use app\common\library\wechat\WxSendGood;

/**
 * 帮助中心
 * Class help
 * @package app\store\controller\wxapp
 */
class Test extends Controller
{
    /**
     * 获取列表记录
     * @return array
     * @throws \think\db\exception\DbException
     */
    public function test()
    {
        $params['out_trade_no'] = "2024012452484910";
        $params['transaction_id'] = "4200002121202312254177040528";
        $params['tmpOutTardeNo'] = "1202402040211823117_26";
        $params['timestamp'] = time();
        $sign = CommonService::getBangDouApisign($params);

        $params['sign'] = $sign;
        $url = 'http://devaa.bangnuo.top/index.php?s=/api/PayNotice/bangnuoNotice&sign=' . $sign;
        $result = helper::httpPost($params,$url);
        var_dump($result);
    }
    public function refund()
    {
        $orderInfo['order_id'] = '2';
        $orderInfo['pay_price'] = '1.01';
        $transaction_id = '4200002109202401313240040349';
        echo BdPayService::bangdouRefund($orderInfo,$transaction_id,null);//三券退款
    }
    public function goods()
    {
        $transaction_id = '4200002096202401311616996395';
        $aa = WxappSettingModel::getWxappConfig(10001);
        $WxSendGood = new WxSendGood($aa);
        echo $WxSendGood->getWxSendOrderStatus($transaction_id);//三券退款
    }

    public function send()
    {
        $order['transaction_id'] = '4200002136202402024315875886';
        $order['title'] = '衬衣测试商品';
        $order['openid'] = 'ouv_E6xU3Epo_B_zhKi06Du04BE0';
        $order['mobile'] = '18972975346';
        $order['tracking_no'] = 'fake-2022121419042712';
        $order['express_company'] = 'fengwang';
        $aa = WxappSettingModel::getWxappConfig(10001);
        $WxSendGood = new WxSendGood($aa);
        $aa = $WxSendGood->sendWechatOrder($order);//三券退款
        var_dump($aa);
    }

}
